package com.cyandpos.pad.refund;

import android.os.Bundle;
import android.os.Message;

import com.cyandpos.pad.activity.RefundActivity;
import com.cyandpos.pad.common.commondata.Constant;
import com.cyandpos.pad.utils.DatePattern;

import java.util.Date;

/**
 * Created by xin on 2021/5/18
 * desc:
 */
public class TimeThread extends Thread  {

    private RefundActivity.MyHandler mHandler;

    public TimeThread(RefundActivity.MyHandler handler) {
        mHandler = handler;
    }

    @Override
    public void run() {
        do {
            try {
                long time = System.currentTimeMillis();
                Date date = new Date(time);
                String format1 =  DatePattern.mDateFormat10.format(date);
                Thread.sleep(1000);
                Message msg = new Message();
                msg.what = Constant.MAIN_UPDATE_CURRENT_TIME_HANDLEID;
                Bundle build = new Bundle();
                build.putString("time", format1);
                msg.setData(build);
                mHandler.sendMessage(msg);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } while (true);
    }
}

